package com.baidu.bos.web.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.baidu.bos.domain.Noticebill;
import com.baidu.bos.domain.User;
import com.baidu.bos.service.INoticebillService;
import com.baidu.bos.utils.BOSContext;
import com.baidu.bos.web.action.base.BaseAction;
import com.baidu.crm.domain.Customer;
import com.baidu.crm.service.CustomerService;
@Controller
@Scope("prototype")
public class NoticebillAction extends BaseAction<Noticebill>{
	@Resource
	private INoticebillService noticebillService;
	@Resource
	private CustomerService customerService;
	private String phone;
	public void setPhone(String phone) {
		this.phone = phone;
	}
	//通过手机号查询客户信息
	public String findCustomerByPhone(){
		Customer customer = customerService.findCustomerByPhone(phone);
		this.writeObject2Json(customer);
		return NONE;
	}
	//保存
	public String save(){
		//获取当前登录的用户
		User user = BOSContext.getLoginUser();
		model.setUser(user);
		noticebillService.save(model);
		return "list";
	}
	
}
